home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
asm
/
pc370_3.exe
/
lha
/
MVS.ALC
< prev
next >
Wrap
Text File
|
1987-06-06
|
18KB
|
660 lines
*********
*
* PGMID. MVS.ALC (LINKED TO MVS.MOD FOR DYNMAIC LOAD AND EXEC)
* AUTHOR. DON HIGGINS
* DATE. 05/26/87
* REMARKS.
* THIS MODULE DEFINES MVS SVC HANDLER AND EXTERNAL
* INTERRUPT HANDLER TO SUPPORT EXECUTION OF MODULES WITH
* MVS SVC'S. RETRUN FROM THIS MODULE IS VIA LPSW WHICH
* PLACES CALLING PROGRAM IN PROBLEM STATE WITH SUPERVISOR
* AND NO EXTERNAL INTERRUPTS ENABLED (EXTERNAL CAN BE TURNED
* ON LATER IF DESIRED). FOR MVS SVC EQU'S SEE MVS.DOC.
*
* MAINTENANCE.
*
* 05/30/87 CHANGE SVC 3 EXIT TO RETURN IN SUPR STATE, ADD SVC 10
* 05/31/87 ADD IGC013 ABEND T1/T4
* 06/01/87 USE SVCR15 TO SIMPLIFY RTN SAVE/RESTORE, CHANGE IGC NAMES
* 06/04/87 SAVE R14,R1 ACROSS EXECRTN FOR SVC'S AND INS'S
* 06/06/87 FIX WTOR TO CLEAR R15 AND USE EXTERNAL INTERRUPT TO POST
*********
*
* MVS NUCLEUS INITIALIZATION PROGRAM (NIP)
*
*********
MVS CSECT
USING MVS,R15
STM R14,R6,12(R13)
LR R6,R15
DROP R15
USING MVS,R6
SVC TRACE
DC C'IOF' TURN OFF INTERRUPTS FOR WTOR FACILITY
*
* INIT CVT
*
LA R1,CVT
USING IHACVT,R1
ST R1,16 STORE CVT ADDRESS IN LOW MEMORY
LA R0,TCB
ST R0,CVTTCBP CVT TCB PTR
LA R0,SMCA
ST R0,CVTSMCA CVT SMCA PTR
L R0,ASCASL
ST R0,CVTMZ00 CVT END OF REAL MEMORY
*
* INIT SVC TABLE
*
LA R1,4*256
SVC GMAIN
LTR R0,R0
BNZ ABEND80A NO MEMORY FOR SVC TABLE
ST R2,ASVCTAB
LR R0,R2
LA R1,4*256
SR R14,R14
SR R15,R15
MVCL R0,R14 CLEAR SVC TABLE
LA R0,IGC0001
ST R0,4*1(R2) INIT SVC 1 WAIT
LA R0,IGC0002
ST R0,4*2(R2) INIT SVC 2 POST
LA R0,IGC0003
ST R0,4*3(R2) INIT SVC 3 EXIT
LA R0,IGC0010
ST R0,4*10(R2) INIT SVC 10 GMAINR/FMAINR
LA R0,IGC0013
ST R0,4*13(R2) INIT SVC 13 ABEND T1
LA R0,IGC0035
ST R0,4*35(R2) INIT SVC 35 WTO/WTOR
*
* INIT INS TABLE
*
LA R1,4*256
SVC GMAIN
LTR R0,R0
BNZ ABEND80A NO MEMORY FOR INS TABLE
ST R2,AINSTAB
LR R0,R2
LA R1,4*256
SR R14,R14
SR R15,R15
MVCL R0,R14 CLEAR SVC TABLE
*
* INIT SVC, PGM, AND EXT NEW PSW'S
*
LA R0,SVCRTN
ST R0,SVCPSW+4 INIT NEW SVC PSW ADDR
LA R0,PGMRTN
ST R0,PGMPSW+4 INIT NEW PGM PSW ADDR
LA R0,EXTRTN
ST R0,EXTPSW+4 INIT NEW EXT PSW ADDR
MVC NEWSVC(8),SVCPSW SET NEW SVC PSW
MVC NEWPGM(8),PGMPSW SET NEW PGM PSW
MVC NEWEXT(8),EXTPSW SET NEW EXT PSW
LM R14,R6,12(R13) RESTORE CALLER'S REG'S
DROP R6
USING MVS,R15
ST R14,PRBPSW+4 INIT PROBLEM STATE EXIT PSW ADDR
*
* EXIT TO CALLER IN PROBLEM STATE TO ACTIVATE MVS SHELL ENVIRONMENT
*
LPSW PRBPSW EXIT WITH NEW PROBLEM PSW
DROP
SVCPSW DS 0D
DC X'060C0000',A(*-*) ENTER SVC HANDLER IN SUPR STATE
PGMPSW DS 0D
DC X'060C0000',A(*-*) ENTER PGM HANDLER IN SUPR STATE
EXTPSW DS 0D
DC X'060C0000',A(*-*) ENTER EXT HANDLER IN SUPR STATE
PRBPSW DS 0D
DC X'070D0000',A(*-*) RETURN WITH PROB. STATE AND EXT. INT.
*********
*
* MVS SVC INTERRUPT HANDLER
*
*********
SVCRTN EQU *
SVC TRACE
DC C'SVC'
DROP
ST R15,SVCR15
L R15,NEWSVC+4
USING SVCRTN,R15
STM R0,R14,SVCSAV
L R14,SVCR15
ST R14,SVCSAV+15*4
L R14,OLDSVC+4 R14 = ADDR SVC + 2
BCTR R14,0
SR R2,R2
IC R2,0(R14) R2=SVC#
L R3,ASVCTAB
LA R4,IGC0NNN
BAL R14,EXECRTN EXECUTE SVC
USING *,R14
LTR R15,R15 WAS EXEC OK
BNZ ABEND106
LM R2,R13,SVCSAV+2*4 RESTORE USER REGS (2-13 ONLY)
LPSW OLDSVC EXIT TO INSTR AFTER ORIG SVC IN PROB STATE
ABEND106 EQU *
L R1,=X'80106000' NO, ABEND 106 WITH DUMP
LA R2,13
L R3,ASVCTAB
LA R4,IGC0NNN
BAL R14,EXECRTN EXECUTE ABEND SVC
DROP
USING *,R14
OI OLDSVC+1,X'02' TURN ON WAIT BIT IN OLD SVC PSW
LM R0,R15,SVCSAV RESTORE ALL REGS TO ORIG.
LPSW OLDSVC IF IT RETURN'S, LOAD WAIT STATE OLD PSW
DROP
SVCSAV DC 16F'0'
********
*
* PROGRAM INTERRUPT ROUTINE
*
********
PGMRTN EQU *
SVC TRACE
DC C'PGM'
DROP
ST R15,PGMR15 TEMP SAVE R15 IN LOW MEMORY
L R15,NEWPGM+4
USING PGMRTN,R15
STM R0,R14,PGMSAV SAVE REGS
L R14,PGMR15
ST R14,PGMSAV+4*15
CLI OLDPGM+3,2 IS THIS PRIVILEGED OR OPERATION EXCEPTION
BH ABEND0CX NO, ABEND 0CX WITH DUMP
L R14,OLDPGM+4 YES, TRY TO LOAD INS0NNN MACRO INSTRUCTION
SR R2,R2
IC R2,0(R14) R2 = OPERATION CODE
L R3,AINSTAB
LA R4,INS0NNN
BAL R14,EXECRTN EXECUTE INS RTN IF FOUND
USING *,R14
LTR R15,R15 WAS MACRO INSTR. EXEC OK
BNZ ABEND0CX NO, ABEND 0CX WITH DUMP
LM R0,R15,PGMSAV RESTORE ALL REGS
LPSW OLDPGM EXIT TO NEXT INSTR IN PROB STATE
DROP
ABEND0CX EQU *
BALR R15,0
USING *,R15
SR R1,R1
IC R1,OLDPGM+3
SLL R1,12
O R1,=X'800C0000' R1=0CX SYSTEM ABEND WITH DUMP
LA R2,13
L R3,ASVCTAB
LA R4,IGC0NNN
BAL R14,EXECRTN EXECUTE ABEND SVC
DROP
USING *,R14
OI OLDPGM+1,X'02' TURN ON WAIT BIT IN OLD PGM PSW
LM R0,R15,PGMSAV
LPSW OLDPGM IF IT RETURN'S, LOAD WAIT STATE OLD PSW
DROP
PGMSAV DC 16F'0' SAVE R0-R15
********
*
* EXTERNAL INTERRUPT ROUTINE
*
* 1. CURRENTLY ONLY FUNCTION IMPLEMENTED VIA EXTERNAL INTERRUPT IS
* ENTRY OF WTOR REPLY WITH POST OF ECB WHEN DONE. ONLY ONE WTOR
* ACTIVE AT A TIME IS SUPPORTED IN THIS SINGLE USER SHELL.
* PC/370 RELEASE 2.0 EXECUTES EXTERNAL INTERRUPT ROUTINE EVERY
* 256 INSTRUCTIONS IF ENABLED AND PROBLEM STATE. THIS WILL
* CAUSE HESITATION ON SLOWER PC'S AND HAVING EXTERNAL INTERRUPT
* ENABLED FOR THIS FACILITY INTRODUCES AROUND 10% OVERHEAD (25
* EXTRA INSTRUCTIONS EVERY 256 INSTRUCTIONS).
*
********
EXTRTN EQU *
SVC TRACE
DC C'EXT'
DROP
ST R15,EXTR15 TEMP SAV R15
L R15,NEWEXT+4
USING EXTRTN,R15
STM R0,R14,EXTSAV SAVE REGS
L R14,EXTR15
ST R14,EXTSAV+4*15
CLI WTORPEND,TRUE EXIT IF NO WTOR PENDING
BNE EXTEXT
SVC KEYSTAT IS THERE KEYBOARD INPUT PENDING
LTR R0,R0 EXIT IF NO KEY PENDING
BZ EXTEXT
L R3,WTORCCNT
L R4,WTORCRPY
WTORLOOP EQU *
SVC KEYSTAT IS THERE KEYBOARD INPUT PENDING
LTR R0,R0
BZ WTORSAVE
SVC KEYREAD
CLM R0,1,=AL1(CR)
BE WTORDONE STOP AT CARRIAGE RETURN
STC R0,0(R4)
LA R4,1(R4)
BCT R3,WTORLOOP REPEAT UNTIL NO MORE CHAR OR FULL
WTORDONE EQU *
MVI WTORPEND,FALSE
LA R2,LF
SVC WRITECHR
LA R2,CR
SVC WRITECHR
L R2,WTORTCNT
SR R2,R3
BZ WTORSKIP SKIP CONVERT IF NO CHAR.
L R1,WTORARPY
SVC ASCEBC CONVERT REPLY TO EBCDIC
WTORSKIP EQU *
L R1,WTORAECB
LA R6,IGC0002
BALR R14,R6 POST WTOR ECB VIA BRANCH ENTRY TO POST
USING *,R14
LM R0,R15,EXTSAV RESTORE ALL REGS
LPSW OLDEXT EXIT TO NEXT INSTR. OR EXIT FROM WAIT
DROP R14
WTORSAVE EQU *
ST R3,WTORCCNT
ST R4,WTORCRPY
EXTEXT EQU *
LM R0,R15,EXTSAV RESTORE ALL REGS
LPSW OLDEXT EXIT TO NEXT INSTR
DROP
EXTSAV DC 16F'0' SAVE R0-R15
********
*
* EXECUTE SVC/INS ROUTINE FROM SVC, PGM, OR EXT INTERRUPT HANDLER
*
* NOTE THIS ROUTINE ALONG WITH INTERRUPT HANDLERS IS CURRENTLY ONLY
* SERIALLY REUSABLE SO NO SVC CAN ISSUE MVS SVC ETC. (PC/370 SVC'S OK).
* THIS IS A SINGLE USER NON-MULTI-TASKING VERSION OF MVS.
*
* R2 = NUMBER OF SVC OR USER DEFINED INSTRUCTION OP CODE
* R3 = SVC/INS TABLE
* R4 = ADDRES OF MODULE NAME 'IGC0NNN' OR 'INS0NNN'
* R14 = RETURN ADDRESS
* R15 = NZ IF LOAD FAILED ELSE ZERO FOR SUCCESSFUL EXECUTION
*
EXECRTN EQU *
BALR R7,0
USING *,R7
CLI LOCK,BUSY
BE ABENDFXX ABEND FXX FOR INVALID RECURSIVE ENTRY
MVI LOCK,BUSY
ST R14,EXECEXT
AR R2,R2
AR R2,R2 R2=4*SVC#